import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/src/widgets/bottom_sheet/filter_bottom_sheet.dart';
import 'package:finance_app/src/widgets/bottom_sheet/filter_contacts_bottom_sheet.dart';

mixin FilterContactSortMixin<T> on BaseProvider<T> {
  List<String> currentSelectFilterList = [];

  int get filterListLength => currentSelectFilterList.length;

  void unFocus();

  void onRequestRefresh();

  bool get isShowNet => true;

  void onShowFilter() {
    unFocus();
    obtainContext.call((context) async {
      currentSelectFilterList = await showFilterContactsBottomSheet(
        context,
        filterContacts: currentSelectFilterList,
        isShowNet:  isShowNet
      );
      onRequestRefresh();
      update();
    });
  }

  void onRemoveFilter(String value) {
    currentSelectFilterList.remove(value);
    onRequestRefresh();
    update();
  }
}
